Another approach to add the class to element using pure JavaScript. For adding class: ... function addClass( classname, element ) { var cn = element. ... <看更多>
that = this is an antipattern in modern Javascript. If you need to use the calling context from the outer scope, use arrow functions instead ... ... <看更多>